<?php
$File = "../../graph/write.php";
//$File = "write.php";
$Handle = fopen($File, 'w');
$a=15;
$b=8;
$c=3;
$d=3;
$e=3;
$f=3;

$Data = "<?php
include (\"./src/jpgraph.php\");
include (\"./src/jpgraph_bar.php\");";
fwrite($Handle, $Data);
$a=15;
$b=8;
$c=16;
$d=16;
$e=6;
$f=6;

$Data="
\$datay=array($a,$b,$c,$d,$e,$f);
\$graph = new Graph(600,400,\"auto\");    
\$graph->SetScale(\"textlin\");
\$graph->SetShadow();
\$graph->img->SetMargin(40,30,20,40);
\$bplot = new BarPlot(\$datay);
\$bplot->SetFillColor('orange');
\$bplot->value->Show();
\$graph->Add(\$bplot);
\$graph->title->Set(\"Bar graph\");
\$graph->xaxis->title->Set(\"X-title\");
\$graph->yaxis->title->Set(\"Y-title\");
\$graph->title->SetFont(FF_FONT1,FS_BOLD);
\$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
\$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
\$graph->Stroke();
?>";
fwrite($Handle, $Data);
print "Data Written";
fclose($Handle);

$myFile = "../../../../temp/jpgraph_cache/write.png";
unlink($myFile);
echo "<img src=\"http://localhost/graph/write.php\">";

?>